package cn.linran.feignclient.fallback;

import cn.linran.User;
import cn.linran.feignclient.UserFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallback implements UserFeignClient {
    //日志打印器
    private Logger log = LoggerFactory.getLogger(UserFeignClientFallback.class);
    @Override
    public User getById(Long id) {
        log.info("用户服务不可用");//2022-08-19 19:25:27.144  INFO 45032 --- [x-user-server-1] c.l.f.fallback.UserFeignClientFallback   : 用户服务不可用
        return new User(-111L,"noName","OpenFeign触发熔断，fallback方式");
    }
}
